/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.Calendar;

/**
 * <p>Project: jse2303 - If1
 * <p>Powered by webrx On 2023-07-11 11:37:27
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class If1 {
    public static void main(String[] args) {
        if (Math.random() > .5) {
            System.out.println("大于.5");
        } else {
            System.out.println("no");
        }

        //根据时间输出上午下午
        Calendar c = Calendar.getInstance();
        int hour = c.get(Calendar.HOUR_OF_DAY);
        if (hour < 12) {
            System.out.println("上午好");
        } else {
            System.out.println("下午好");

        }

        //三元运算符 表达式
        String info = hour >= 12 ? "下午好" : "上午好";
        System.out.println(info);
    }
}
